<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>测试API</title>
<script type="text/javascript" src="${ctxStatic}/assets/sys/testapi.js"></script>
<script type="text/javascript" src="${ctxStatic}/assets/sys/fileupload.js"></script>
<style type="text/css">
.input{width:100%}
input[type=file]{display:inline}
</style>
</head>
<body>
	<sys:message content="${message}" />
	<div class="admin-content">
		<div class="am-container">
			<h3>使用说明</h3>
			<ol>
				<li>一些涉及到当前用户才能操作的接口，必须以手机号登陆才能进行测试</li>
				<li>所有日期类返回结果都是long型，对于返回字符串型的，是供网页用的，客户端用不到</li>
				<li>对于后边有提交按钮的，可以在输入框中输入参数，直接提交</li>
				<li>如果参数命名是复数，那么类型就是数组，用逗号隔开，或者多个相同参数名</li>
				<li>如果用到AES加密的，则密钥为128位，即16个字节，如果不足16个字节，那么后边补0，如果超过16个字节，则截取前16个，加密后再用url_safe_base64进行编码</li>
				
			</ol>
			<h3>常见返回值</h3>
			<ol>
				<c:forEach items="${errcodes}" var="code"><li>${code}</li></c:forEach>
			</ol>
		</div>
		<div class="am-g">
			<div class="am-u-sm-12">
				<script id="test-tpl" type="text/x-handlebars-template">
				<table class="am-table am-table-bd am-table-striped admin-content-table">
					<caption>API测试</caption>
					<thead><tr><th>URL</th><th>参数</th><th>提交方式</th><th>&nbsp;</th></tr></thead>
					<tbody>
					{{#each this}}
  						<tr>
							<td>{{url}}</td>
							<td>
								{{#each paramDoc}} <span class="am-text-xs"><span class="am-text-warning">{{key}}</span>:&nbsp;<span class="am-text-primary">{{value}}</span></span><br/> {{/each}}
								{{#extif cantest '&&' params}}
									{{#extif url '==' '/api/1/file/upload.json'}} type=<input type="text" name="type"/>files=<input type="file" id="fileinput" name="files"/>
									{{else}}<input class="input" type="text" name="params" value="{{#each params}}{{this}}=&{{/each}}">
									{{/extif}}	
								{{else}}
									{{#each params}}{{this}} | {{/each}}
								{{/extif}}
							</td>
							<td>{{method}}</td>
							<td>{{#if cantest}}<button id="clearCache" class="am-btn am-btn-danger" type="button">提交</button>{{/if}}</td>
						</tr>
						{{#if cantest}}<tr style='display:none;background:#F37B1D'><td colspan='4'>hidden</td></tr>{{/if}}
					{{/each}}
					</tbody>
				</table>
				</script>
			</div>
		</div>
	</div>
</body>
</html>